package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//攻略目录
@Getter@Setter@ToString
@JsonIgnoreProperties({"handler","json"})
public class StrategyCatalog  extends BaseDomain{
    public static final Boolean STATE_ON =true;//启用
    public static final Boolean STATE_OFF =false;//禁用

    private String name;

    private Strategy strategy;

    private Integer sequence;

    private Boolean state=STATE_ON;

    private List<StrategyDetail> strategyDetail =new ArrayList<>();

    public String getStateName(){
        String stateNmae="启用";
        if (STATE_OFF.equals(state)){
            stateNmae="禁用";
        }
        return stateNmae;
    }

    public Object getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("strategy",strategy);
        map.put("sequence",sequence);
        map.put("state",state);

        return JSONUtil.toJSONString(map);
    }

}